package com.neo4j.neo4jcloud.service.impl;

import com.neo4j.neo4jcloud.entity.SupplyGraph;
import com.neo4j.neo4jcloud.mapper.SupplyGraphRepository;
import com.neo4j.neo4jcloud.service.SupplyGraphService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author kabuqinuo
 * @date 2020/3/26 14:09
 */
@Service
public class SupplyGraphServiceImpl implements SupplyGraphService {

    @Autowired
    private SupplyGraphRepository supplyGraphRepository;


    @Override
    public SupplyGraph addSupplyGraph(SupplyGraph supplyGraph) {
        return supplyGraphRepository.save(supplyGraph);
    }

    @Override
    public SupplyGraph findBySupplyGraphId(Long id) {
        return supplyGraphRepository.findById(id).get();
    }

    @Override
    public void deleteOneBySupplyGraphId(Long id) {
        supplyGraphRepository.deleteById(id);
    }

    @Override
    public SupplyGraph findOneByNodeId(String nodeId) {
        return supplyGraphRepository.findOneByNodeId(nodeId);
    }
}
